package demo02.Stream;

import java.util.stream.Stream;

/*

    Stream流中的常用方法_concat:用于把流组合到一起
    如果有两个流，希望合并成为一个流，那么可以使用Stream接口的静态方法concat
    static <T> Stream<T> concat(Stream<? extends T> a, Stream<? extends T> b)

 */
public class Demo08Stream_concat {
    public static void main(String[] args) {
        Stream<String> stream = Stream.of("苹果", "西瓜", "香蕉", "西红柿");
        Stream<String> stream2 = Stream.of("Hello", "World", "Java");
        Stream<Integer> stream3 = Stream.of(3,5,6,7);

        Stream<String> concat = Stream.concat(stream, stream2);
        concat.forEach(name-> System.out.println(name));
    }
}
